<?php extract ( $_GET );

	include '../wp-includes/php/DBManager.class.php';
	$db = new DBManager ( 'localhost', 'root', '', 'iumus' );
	
	$query = "SELECT DataPrimaVisione, DataScadenza FROM filmnoleggio WHERE idUser = '".$user."' ";
	$query .= "AND idFilm = '".$id."' ";
	$result = $db->executeQuery ( $query );
	$row = mysql_fetch_array ( $result );
	
	if ( $row[0] == "" && $row[1] == "" ) {
		$query = "UPDATE filmnoleggio SET DataPrimaVisione = NOW(), DataScadenza = DATE_ADD( NOW(), INTERVAL 3 DAY ) WHERE idUser = '".$user."' ";
		$query .= "AND idFilm = '".$id."' ";
		$result = $db->executeQuery ( $query );
	}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

	<title>BroadCastWorldWideWebMedia</title>

	<style type="text/css">
		body { background-color: #fff; padding: 0 20px; color:#000; font: 13px/18px Arial, sans-serif; }
		a { color: #360; }
		h3 { padding-top: 20px; }
		ol { margin:5px 0 15px 16px; padding:0; list-style-type:square; }
	</style>

</head>
<body>

	<!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE -->
	<center><div id="mediaplayer">JW Player goes here</div></center>
	
	<script type="text/javascript" src="jwplayer.js"></script>
	<script type="text/javascript">
		jwplayer("mediaplayer").setup({
			flashplayer: "player.swf",
			file: "../films/video.mp4",
			image: "<?php echo $cover; ?>",
			height: 683,
			width: 564
		});
	</script>
	<!-- END OF THE PLAYER EMBEDDING -->
</body>
</html>